def even_numbers(nums: list, n: int) -> list:
    result = []
    for i in range(len(nums) - 1, -1, -1):
        if nums[i] % 2 == 0:
            result.insert(0, nums[i])
            if len(result) == n:
                return result


if __name__ == '__main__':
    nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    n = 3
    print(even_numbers(nums, n))
